package com.vietnam.power.persistence;

import java.io.Serializable;

import javax.persistence.*;

import org.hibernate.annotations.Type;

import java.util.List;

/**
 * The persistent class for the file database table.
 * 
 */
@Entity
@Table(name = "file")
public class File implements Serializable {
	private static final long serialVersionUID = 1L;
	private Long fileId;
	private String webPath;
	private String mobilePath;
	private boolean status;
	private String thumbPath;
	private List<Category> categories;
	private List<ChatMessage> chatMessages;
	private List<ProductImage> productImages;
	private List<UserInfo> userInfos;

	public File() {
	}

	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	@Column(name = "FILE_ID")
	public Long getFileId() {
		return this.fileId;
	}

	public void setFileId(Long fileId) {
		this.fileId = fileId;
	}

	@Column(name = "MOBILE_PATH")
	public String getMobilePath() {
		return mobilePath;
	}

	public void setMobilePath(String mobilePath) {
		this.mobilePath = mobilePath;
	}

	@Column(name = "WEB_PATH")
	public String getWebPath() {
		return this.webPath;
	}

	public void setWebPath(String webPath) {
		this.webPath = webPath;
	}

	@Type(type="true_false")
	public boolean getStatus() {
		return this.status;
	}

	public void setStatus(boolean status) {
		this.status = status;
	}

	@Column(name = "THUMB_PATH")
	public String getThumbPath() {
		return this.thumbPath;
	}

	public void setThumbPath(String thumbPath) {
		this.thumbPath = thumbPath;
	}

	// bi-directional many-to-one association to Category
	@OneToMany(mappedBy = "file")
	public List<Category> getCategories() {
		return this.categories;
	}

	public void setCategories(List<Category> categories) {
		this.categories = categories;
	}

	public Category addCategory(Category category) {
		getCategories().add(category);
		category.setFile(this);

		return category;
	}

	public Category removeCategory(Category category) {
		getCategories().remove(category);
		category.setFile(null);

		return category;
	}

	// bi-directional many-to-one association to ChatMessage
	@OneToMany(mappedBy = "file")
	public List<ChatMessage> getChatMessages() {
		return this.chatMessages;
	}

	public void setChatMessages(List<ChatMessage> chatMessages) {
		this.chatMessages = chatMessages;
	}

	public ChatMessage addChatMessage(ChatMessage chatMessage) {
		getChatMessages().add(chatMessage);
		chatMessage.setFile(this);

		return chatMessage;
	}

	public ChatMessage removeChatMessage(ChatMessage chatMessage) {
		getChatMessages().remove(chatMessage);
		chatMessage.setFile(null);

		return chatMessage;
	}

	// bi-directional many-to-one association to ProductImage
	@OneToMany(mappedBy = "file")
	public List<ProductImage> getProductImages() {
		return this.productImages;
	}

	public void setProductImages(List<ProductImage> productImages) {
		this.productImages = productImages;
	}

	public ProductImage addProductImage(ProductImage productImage) {
		getProductImages().add(productImage);
		productImage.setFile(this);

		return productImage;
	}

	public ProductImage removeProductImage(ProductImage productImage) {
		getProductImages().remove(productImage);
		productImage.setFile(null);

		return productImage;
	}

	// bi-directional many-to-one association to UserInfo
	@OneToMany(mappedBy = "file")
	public List<UserInfo> getUserInfos() {
		return this.userInfos;
	}

	public void setUserInfos(List<UserInfo> userInfos) {
		this.userInfos = userInfos;
	}

	public UserInfo addUserInfo(UserInfo userInfo) {
		getUserInfos().add(userInfo);
		userInfo.setFile(this);

		return userInfo;
	}

	public UserInfo removeUserInfo(UserInfo userInfo) {
		getUserInfos().remove(userInfo);
		userInfo.setFile(null);

		return userInfo;
	}

}